<h1>Format overview</h1>
<p>Below is a simple guide to the basic structure of a typical IMS Enterprise 
data file. Much more information is available on the <a href="http://www.imsglobal.org/enterprise/">IMS Enterprise official website</a>.</p>

<p>You may like to read the <a href="./enrol/imsenterprise/entv1p1_conformance_summary.html">conformance summary</a> which describes which IMS data elements this plugin can process.</p>


<h1>Basic guide to IMS Enterprise file format</h1>

<p>For any IMS-style enrolment you need a &lt;group&gt; tag which specifies the course, a &lt;person&gt; tag which specifies the user account, and a &lt;membership&gt; tag containing &lt;member&gt; tags which specify a person's role within a given course.</p><p>
</p>

<p>
Remember that the numeric keys used in the Moodle databases are not the interoperable data - a student data system is never going to know in advance that Joe is the 20th user added to the Moodle database - so those aren't the keys exchanged in this type of data.</p><p>
</p>

<p>
Typically a course would have a reference code as well as a name, so let's assume its code is MOODLE101. To define your course you could use</p><p>
</p>

<p>
&nbsp; &lt;group&gt;<br />
&nbsp; &nbsp; &lt;sourcedid&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;source&gt;MyDataSystem&lt;/source&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;id&gt;MOODLE101&lt;/id&gt;<br />
&nbsp; &nbsp; &lt;/sourcedid&gt;<br />
&nbsp; &nbsp; &lt;description&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;short&gt;Moodle 101&lt;/short&gt;<br />
&nbsp; &nbsp; &lt;/description&gt;<br />
&nbsp; &lt;/group&gt;<br />
</p>

<p>
The enrolment script will look for a course with code MOODLE101, and (optionally) create it if it doesn't exist. Similarly for the person - let's assume it's &quot;jmoodle&quot;:</p><p>
</p>

<p>
&nbsp; &lt;person&gt;<br />
&nbsp; &nbsp; &lt;sourcedid&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;source&gt;MyDataSystem&lt;/source&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;id&gt;jmoodle&lt;/id&gt;<br />
&nbsp; &nbsp; &lt;/sourcedid&gt;<br />
&nbsp; &nbsp; &lt;userid&gt;jmoodle&lt;/userid&gt;<br />
&nbsp; &nbsp; &lt;name&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;fn&gt;Joe Moodle&lt;/fn&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;n&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;family&gt;MOODLE&lt;/family&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;given&gt;JOE&lt;/given&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/n&gt;<br />
&nbsp; &nbsp; &lt;/name&gt;<br />
&nbsp; &lt;/person&gt;<br />
</p>

<p>
If Joe doesn't already have an account, the script can (optionally) create an account for him.</p>


<p>
Let's now look at the membership, adding the person to the course:</p><p>
</p>

<p>
&nbsp; &lt;membership&gt;<br />
&nbsp; &nbsp; &lt;sourcedid&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;source&gt;MyDataSystem&lt;/source&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;id&gt;MOODLE101&lt;/id&gt;<br />
&nbsp; &nbsp; &lt;/sourcedid&gt;<br />
&nbsp; &nbsp; &lt;member&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;sourcedid&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;source&gt;MyDataSystem&lt;/source&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;id&gt;jmoodle&lt;/id&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/sourcedid&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;role roletype=&quot;01&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;status&gt;1&lt;/status&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;extension&gt;&lt;cohort&gt;unit 2&lt;/cohort&gt;&lt;/extension&gt;<br />
&nbsp; &nbsp; &nbsp; &lt;/role&gt;<br />
&nbsp; &nbsp; &lt;/member&gt;<br />
&nbsp; &lt;/membership&gt;<br />
</p>

<p>
The IMS Enterprise specification does offer a facility for specifying start/end dates for enrolments, so those can be included using the &lt;timeframe&gt; tag if needed.</p><p>
</p>

<p>
If a person is already added to a group within the course, the script won't actually modify that. If they are not grouped, however, then the specified grouping will be applied.</p><p>

